package com.google.gson.internal.bind;

import com.google.gson.b.a;
import com.google.gson.b.c;
import com.google.gson.b.d;
import com.google.gson.internal.ObjectConstructor;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.Collection;

final class e extends TypeAdapter {
    final /* synthetic */ d a;
    private final TypeAdapter b;
    private final ObjectConstructor c;

    public e(d dVar, l lVar, Type type, TypeAdapter typeAdapter, ObjectConstructor objectConstructor) {
        this.a = dVar;
        this.b = new x(lVar, typeAdapter, type);
        this.c = objectConstructor;
    }

    public Collection a(a aVar) throws IOException {
        if (aVar.f() == c.NULL) {
            aVar.j();
            return null;
        }
        Collection collection = (Collection) this.c.construct();
        aVar.a();
        while (aVar.e()) {
            collection.add(this.b.b(aVar));
        }
        aVar.b();
        return collection;
    }

    public void a(d dVar, Collection collection) throws IOException {
        if (collection == null) {
            dVar.f();
            return;
        }
        dVar.b();
        for (Object a : collection) {
            this.b.a(dVar, a);
        }
        dVar.c();
    }

    public /* synthetic */ Object b(a aVar) throws IOException {
        return a(aVar);
    }
}
